<?                                                      
function article_row($article, $group_name, $pattern_list=array(), $parent_key=false)                                                      
{                                                      
    $tag   = $article->nntp_message_id;                                                      
    $id    = is_sub ? "" : "";                                                      
    $html  = "<tr bgcolor='white' ";                                                      
    $cell  = "";                                                      
    if ($parent_key)                                                      
    {                                                      
        $html .= "id='ats".$parent_key."' class='".$tag."' style='display:none'";                                                      
    }                                                      
    else                                                      
    {                                                      
        $html .= "id='atr".$tag."'";                                                      
        $cell  = count($pattern_list) > 0 ? count($pattern_list) : "";                                                      
    }                                                       
                                                          
    $html .= "><td nowrap";                                                      
    $html .= "><img src='images/" . (count($pattern_list)>1?"splus1.gif":"sub.gif") . "'                                                       
                      onclick='toggle(".$tag.")' style='cursor:hand'></td>                                                       
                 <td nowrap>                                                      
                     <a id='alef".$tag."' " . (count($pattern_list)>1?"class='navig'":"") . "                                                       
                     href='javascript:doTrans(\"X\", \"" . $tag . "\", \""                                                      
                                                         . $group_name . "\")'                                                      
                       >" . chop_str($article->subject,100) . "</a>                                                      
                 </td>                                                      
                 <td align=right>                                                      
                     <a>".$cell."</a>                                                      
                 </td>                                                      
                      </tr>";                                                       
   return $html;                                                       
}                                                      

function registered_servers ()                                                      
{                                                         
     echo "<font size=2 color='$h1_text' face='Verdana, Arial, Helvetica, sans-serif'><b>Registered Servers</b></font><br><br>";                                                      
    $folders = get_profile_value($host, "servers");                                                      
    parse_str( $folders );                                                      
                                                          
    while (list($a,$b)=each($sg_s))                                                      
    {                                                      
         echo "<a href='#' style='border:none'><img style='border:none' src='images/server2.jpg' align=absmiddle><u>" . $a . "</u></a><br>";                                                      
    }                                                      
    return;                                                       
}                                                      

function bookmarked_articles ()                                                      
{                                                       
    global $host;                                                      
    global $h1_text;                                                      
    global $href;                                                      
    $folders = get_profile_value($host, "folders");                                                      
    parse_str( $folders );                                                      
    $folder = $sg_f[time()%count($sg_f)];                                                      
                                                          
                                                          
    $table="<table cellpadding=0 cellspacing=0 width='100%'>";                                                      
    $thumb=array();                                                      
    if (count($sg_f)>0)                                                      
    {                                                      
        # foreach ($sg_f as $folder)                                                      
        for ($p=0;$p<count($sg_f);$p++)                                                      
        {                                                      
            $folder=$sg_f[$p];                                                      
            $cookie_bookmark = get_profile_value($host, $folder);                                                       
            if ($cookie_bookmark=="")                                                      
            {                                                      
                $table.= "<tr>";                                                      
                $table.= "<td nowrap class='listrowsmall' style='border-left:solid 1px silver'>";                                                      
                # $table.= "<td>";                                                      
                $table.= "<img style='border:none' src='images/bookmark.jpg' hspace=2 align=absmiddle>";                                                      
                $table.= "<a href='".$href."?sub=book&bkf=$folder' class='normal'>$folder</a></td>";                                                      
                $table.= "</tr>";                                                      
            }                                                      
            else                                                      
            {                                                      
                $arr  = explode ("&", $cookie_bookmark);                                                      
                $art  = $arr[time()%count($arr)];                                                                  
                if ($art!="")                                                      
                {                                                      
                    $mark = explode (",", $art);                                                      
                    $thumb[] = "<a href='".$href."?sub=book&bkf=$folder'>                                                      
                    <img border='0' id='ibk' onload=\"correct_width ('ibk', this.width, this.height, 94);desktop_background_resize();\" src='".$href."?message_id=".$mark[1]."&art_group=".$mark[0]."&pp_w=94'></a>                                                        
                    <br>                                                      
                    <a href='".$href."?sub=book&bkf=$folder'>" . $folder . "</a>";                                                        
                }                                                      
                $table.= "<tr>";                                                      
                $table.= "<td nowrap class='listrowsmall' style='border-left:solid 1px silver'>";                                                      
               # $table.= "<td>";                                                      
                $table.= "<img style='border:none' src='images/bookmark.jpg' hspace=2 align=absmiddle>";                                                      
                $table.= "<a href='".$href."?sub=book&bkf=$folder' class='normal'><b>$folder</b></a> (".count($arr).")";                                                      
                $table.= "</td>";                                                      
                $table.= "</tr>";                                                       
            }                                                      
            if ($p>3)                                                      
            {                                                      
                break;                                                      
            }                                                      
        }                                                      
        $table.= "</table>";                                                      
        $thumb = $thumb[time()%count($thumb)];                                                      
                                                              
                                                           
                                                              
        # echo "<table cellpadding=0 cellspacing=0 class='bevel3' style='border:solid 1px silver;width:200px'>";                                                      
        echo "<table width='100%' class='bevel3'>";                                                      
        echo "  <tr>";                                                      
        echo "    <td align=center>";                              
        echo "    <b style='font-size:9pt'>" . $cnt . " Bookmark folders</b>";                                        
        echo "<table cellpadding=4 width='100%' cellspacing=4 class='bevel4'>";                                                      
        echo "<tr>";                                                      
        echo "<td align=center>";                                                                              
        echo "" . $thumb . "";                                                      
        echo "</td>";                                                      
        echo "<td valign=top><img src='/webservices/images/clear.gif' width='1' height='125'>";                                                    
        echo "</td>";                                                      
        echo "<td valign=top>";                                                                              
        echo "" . $table . "";                                                      
        echo "  <div align=right>";                                                      
        echo "  <a href='" . $href . "?sub=book'>All bookmarks</a>";                                                      
        echo "  </div>";                                                    
        echo "</td>";                                                      
        echo "</tr>";                                                        
        echo "</table>";                                                     
        echo "    </td>";                                                      
        echo "  </tr>";                                                      
        echo "</table>";                      
/*                                               
        echo "<table cellpadding=0 cellspacing=0 class='bevel3' style='border:solid 1px silver;width:200px'>";                                                      
        echo "<tr><td colspan=2 class='listrowsmall' style='background-color:white'>";                                                      
        echo "<font size=2 color='" . $h1_text . "' face='Verdana, Arial, Helvetica, sans-serif'><b>" . $cnt . " bookmark folders</b></font></td></tr>";                                                      
        echo "<tr><td align=center class='listrowsmall'>$thumb</td><td class='listrowsmall' valign=top>" . $table . "</td></tr>";                                                      
        echo "<tr><td colspan=2 align=right style='padding:2px'><a href='" . $href . "?sub=book'>All bookmarks</a></td></tr>";                                                      
        echo "</table>";                                                      
          */                                                    
                                                              
    }                                                      
    else                                                      
    {                                                      
        print "<div align='left'><font size=2 color='". $h1_text                                                       
          . "' face='Verdana, Arial, Helvetica, sans-serif'                                                      
          ><b>No bookmarked images</b></font> <br><br>                                                      
           <font size='2' color='#999999' face='Times New Roman, Times, serif'>                                                      
           You have no bookmarked images. <b>Bookmarking</b> an image means that                                                       
           the image remains in your personal image gallery until you delete it                                                       
           or the image is removed from all news servers in your subscription list.                                                        
           To bookmark any image, click the <img align='absmiddle' src='image.php?i=book'>                                                       
           Bookmark Image link next to any image  preview.&nbsp;</div>";                                                      
    }                                                      
    return;                                                      
                                                            
}                                                      

function subscribed_groups ()                                                      
{                                                       
    global $sg_c;                                                      
    global $href;                                                      
    global $user;                                                      
    global $pass;                                                       
    if (isset($sg_c) && is_array($sg_c) && count($sg_c)>0)                                                      
    {                          
        $x=1;                                                       
        for ($e=0;$e<count($sg_c);$e++)                                                      
        {                                                      
            $gl=$sg_c[$e];                                                      
            if ($gl!="")                                                      
            {                          
                 if (5 < $x++) break;                                                      
                 print "<tr>                                                     
                 <td  class='listrowsmall' nowrap>                                                      
                     <a class='normal' href='".$href."?g=".$gl."'>".$gl."</a>                                                      
                 </td>                                                      
                 <td align=right  class='listrowsmall'>                                                      
                     <a>".$gi["count"]."</a>                                                      
                 </td>                                                      
                      </tr>";                                                       
            }                                                      
        }   ?>                                                       
         <tr>                                                      
           <td colspan="2" align="right" style='padding:2px'>                                                      
           <a href="javascript:fb_edit ('sub', 'all')">All subscribed groups</a>                                                      
           &nbsp;                                                      
           </td>                                                      
         </tr> <?                                                       
    }                                                      
    else                                                      
    { ?>                                                      
         <tr>                                                      
           <td colspan="2" style="padding:3px">                                                       
           <img src="image.php?i=p"  align="left"/>                                                      
           <font size="2" color="#999999" face="Times New Roman, Times, serif">                                                      
           You have no subscribed groups. Subscribing to a newsgroup means that you                                                       
           can easily access its content without searches later. To view a complete                                                       
           list of newsgroups that are available for subscription, <a href="<?= $href?>?sub=all">click here</a>.</font>                                                      
           &nbsp;                                                      
           </td>                                                      
         </tr> <?                                                       
    }                                                      
}                                                      

function category_list ()                                                     
{                                                     
    global $categories;                                                   
    global $nntp_server;                                                
    global $cmp_sort_key;                                                   
                                                  
                                                                                          
    $cmp_sort_key = get_profile_value($host, "listsort");                                                                                       
    if ($cmp_sort_key=="")                                                 
    {                                                
       $cmp_sort_key="size";                                                    
    }                                                                                      
    $default_server = get_profile_value($host, "defaultserver");                                                        
    if (strlen($default_server) > 0)                                                    
    {                                                    
        $nntp_server = $default_server;                                                    
    }                                                   
?>                                                      
     <table width='100%' class='bevel3'>                                                      
         <tr>                                                      
             <td valign="top" align='center'><b style='font-size:9pt'>Newsgroup Categories</b>                                 
     <table width='100%' class='bevel4' cellpadding="5">                                                      
         <tr>                                                      
             <td valign="top">                                                      
 <?                                  
        reset ($categories);                                                                                                                                                                                     
        $group_results=array();                                                                                                                                                                                        
        $array = nntp_load_list ($nntp_server);                                                                                                                                 
        $cat_count=1;                                                                                                                
        # lookup ---------------------------------------------------------'                                                                                                                                                                                                                  
        while (list($x,$y)=each($categories))                                                                                                                                                                                        
        {                                                                                                                                                                                          
            $group_result=nntp_group_list ($array, $y[1]);                                                                                                                                                                                                 
            uasort ($group_result,cmp_by_size);                                                                                                                                                                                                    
            $group_count=1;                                                                                                                                                                                                
            $cat_count++;                                                                                                                                                                                                
            $group_list=array();                                                                                                                                                                                                 
            $odd=true;                                                                                                                                                                                    
            echo "<div style='font-size:9pt'>$x</div>";                                                                                                                                                              
            foreach ($group_result as $result)                                                                                                                                                                                                           
            {                                                                                                                                                               
                if ($result["size"]>0)                                                                                                                                                                                                          
                {                                                            
                    $gr=preg_replace (                                                                      
                      array("/alt\./","/binaries\./","/multimedia\./","/pictures\./","/movies\./","/mp3\./","/\.sounds/"),                                                                      
                      "",                                                                      
                      $result["group"]                                                                     
                     );                                                                                                                                                     
                    $group_list[] = "<a href='$href?g=" . $result["group"] . "'><u style='color:blue;font-size:7pt'>" . $gr . "</u></a>";                                                                                                                                                
                    $group_count++;                                                                                                                                                                                                 
                    if ($group_count > 6)                                                            
                    {                                                                                                                                                     
                        break;                                                           
                    }                                                                                                                                                                                                       
                }                                                                                                                                                                                                          
            }                                            
            echo implode (', ', $group_list);                                         
            echo ", ";                                                                                                                                                                                             
            echo "<a href='$href?sub=all&cat=$x' style='color:#000066'>...</a>";                                                                                                                                                                                       
            echo "<br>";                                                                                                                                                                                                    
            if ($cat_count > 3)                                                            
            {                                                                                                                                                     
                break;                                                           
            }                                                                                                                                                                                          
        }                                                     
?>                                                      
             </td>                                                      
         </tr>                                                      
     </table>                                            
             </td>                                                      
         </tr>                                                      
     </table>                                                      
 <?                                  
                                                                     
}                                                     


function preview_table ($message, $group, $image=false) {                                                      
     global $nntp_server;                                                      
     $src=$image?"newsgroups.php?message_id=". $message ."&art_group=". $group ."&pp_w=320&nntp=".$nntp_server:""; ?>                                                      
     <table width='100%' cellpadding="5" cellspacing="5">                                                      
         <tr>                                                      
             <td valign="top">                                                      
             <div id='dpreview'                                                       
                  style="height:322;                                                        
                         overflow:hidden;                                                      
                         filter:progid:DXImageTransform.Microsoft.RandomDissolve();">                                                      
             <img id='ipreview'                                                       
                  border='1'                                                       
                  onerror='ipreview.style.display="none"'                                                      
                  onclick='window.open(this.src)'                                                      
                  src="<?=$src?>"                                                      
              ></div>                                                       
             </td>                                                      
             <td width='100%' valign="top">                                                      
             <div id="dinfo" style="font:8pt tahoma;">                                                      
             <script>                                                       
             infobomb("<?= $message ?>", "<?= $group ?>");                                                      
             </script>                                                      
             </div>                                                      
             </td>                                                      
        </tr>                                                      
    </table><?                                                      
}                                                      
?>